import moment from 'moment';
export const searchProps = [
  {
    type: 'input',
    value: 'productName',
    name: '名称',
    style: {
      width: '180px',
    },
    placeholder: '请输入',
  },
  {
    type: 'select',
    value: 'status',
    name: '状态',
    selectOptions: [
      {
        label: '启用',
        value: 0,
      },
      {
        label: '禁用',
        value: 1,
      },
    ],
    placeholder: '请选择',
    style: {
      width: '180px',
    },
  },
];

const productMap = {
  0: 'api',
  1: '产品',
};

export const columns = [
  // {
  //   title: '序号',
  //   dataIndex: 'index',
  //   width: 70,
  //   customRender: (text, record, index) => `${index + 1}`,
  // },
  // {
  //   dataIndex: 'id',
  //   title: '产品ID',
  //   ellipsis: true,
  //   width: 180,
  //   customRender: (text) => (text === 0 ? 0 : text || '/'),
  // },
  {
    dataIndex: 'companyName',
    title: '公司名称',
    ellipsis: true,
    width: 200,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'productName',
    title: '产品名称',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'productNike',
    title: '产品昵称',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'icon',
    title: '图标',
    ellipsis: true,
    width: 120,
    scopedSlots: { customRender: 'icon' },
  },
  
  {
    dataIndex: 'status',
    title: '启用状态',
    ellipsis: true,
    width: 150,
    scopedSlots: { customRender: 'status' },
  },

  {
    dataIndex: 'timingTime',
    title: '定时开关时间',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'limitingNum',
    title: '限制条数',
    ellipsis: true,
    width: 150,
    customRender: (text) => (text === 0 ? 0 : text || '/'),
  },
  {
    dataIndex: 'limitingSwitch',
    title: '限制开关',
    ellipsis: true,
    width: 150,
    scopedSlots: { customRender: 'limitingSwitch' },
  },
  {
    dataIndex: 'needManual',
    title: '推送开关',
    ellipsis: true,
    width: 150,
    scopedSlots: { customRender: 'needManual' },
  },

  {
    dataIndex: 'pushTypeName',
    title: '推送类型',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'productType',
    title: '产品类型',
    ellipsis: true,
    width: 150,
    customRender: (text) => productMap[text] || '/',
  },
  {
    dataIndex: 'price',
    title: '产品价格',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'weight',
    title: '权重',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  
  {
    dataIndex: 'loanQuota',
    title: '产品最高可借额度',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'productUrl',
    title: '产品链接',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'loanCycle',
    title: '周期',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'rate',
    title: '利率',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  
  {
    dataIndex: 'tips',
    title: '标签',
    ellipsis: true,
    width: 150,
    scopedSlots: { customRender: 'tips' },
  },
  {
    dataIndex: 'handlerCode',
    title: 'handlerCode',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    title: '操作',
    width: 180,
    align: 'center',
    fixed: 'right',
    dataIndex: 'operation',
    scopedSlots: {
      customRender: 'operation',
    },
  },
];

export const searchProps1 = [
 
  {
    type: 'select',
    value: 'dealType',
    name: '消耗类型',
    selectOptions: [
      {
        label: '增加',
        value: 0,
      },
      {
        label: '减少',
        value: 1,
      },
    ],
    placeholder: '请选择',
    style: {
      width: '180px',
    },
  },
  {
    type: 'date2',
    value: 'time',
    name: '提交时间',
    placeholder: '请选择',
    showTime: true,
    style: {
      width: '360px',
    },
  },
];
export const columns1 = [
  {
    title: '序号',
    dataIndex: 'index',
    width: 70,
    customRender: (text, record, index) => `${index + 1}`,
  },
  // {
  //   dataIndex: 'type',
  //   title: '产品类型',
  //   ellipsis: true,
  //   width: 200,
  //   customRender: (text) => text  === 1  ? '渠道' : '产品',
  // },
  // {
  //   dataIndex: 'upDownId',
  //   title: '上下游id',
  //   ellipsis: true,
  //   width: 200,
  //   customRender: (text) => text || '/',
  // },
  {
    dataIndex: 'upDownName',
    title: '产品名称',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'rechargeType',
    title: '状态',
    ellipsis: true,
    width: 100,
    customRender: (text) => text  === 1 ? '增加' : '减少',
  },
  {
    dataIndex: 'amount',
    title: '金额',
    ellipsis: true,
    width: 120,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'remark',
    title: '备注',
    ellipsis: true,
    width: 180,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'createTime',
    title: '消耗时间',
    ellipsis: true,
    width: 180,
    customRender: (text) => text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '/',
  },
];
